home *** CD-ROM | disk | FTP | other *** search
/ Aminet 22 / Aminet 22 (1997)(GTI - Schatztruhe)[!][Dec 1997].iso / Aminet / dev / src / ConfigFileSrc.lha / ConfigFileSrc12 / Library / Funcs / Lock.c < prev    next >
Encoding:
Text File  |  1997-10-02  |  4.9 KB  |  174 lines

  1. /*
  2. **        $PROJECT: ConfigFile.library
  3. **        $FILE: Lock.c
  4. **        $DESCRIPTION: cf_Lock#?() functions
  5. **
  6. **        (C) Copyright 1996-1997 Marcel Karas
  7. **             All Rights Reserved.
  8. */
  9.  
  10. /****** configfile.library/cf_LockArgList ************************************
  11. *
  12. *   NAME
  13. *        cf_LockArgList -- Locks the argument list of a group node for use.
  14. *
  15. *   SYNOPSIS
  16. *        FirstArgNode = cf_LockArgList(GrpNode);
  17. *        D0                            A0
  18. *
  19. *        CFArgument * cf_LockArgList(CFGroup *);
  20. *
  21. *   FUNCTION
  22. *        This function locks the argument list of a group node for use, or
  23. *        NULL if the group node has no argument nodes. The pointer returned
  24. *        by this is NOT an actual ArgNode pointer - you should use one of the
  25. *        other ArgNode calls to get actual pointers to ArgNode structures
  26. *        (such as cf_NextArgNode()), passing the value returned by
  27. *        cf_LockArgList() as the ArgNode value.
  28. *
  29. *   INPUTS
  30. *        GrpNode - The group node for the argument list.
  31. *
  32. *   RESULT
  33. *        FirstArgNode - First argument node of the group node or NULL.
  34. *                       NOT a valid node!
  35. *
  36. *   EXAMPLE
  37. *        CFGroup    * myGrpNode;
  38. *        CFArgument * myArgNode;
  39. *
  40. *        ...
  41. *
  42. *        if ( myArgNode = cf_LockArgList (myGrpNode) )
  43. *        {
  44. *           while ( myArgNode = cf_NextArgument (myArgNode) )
  45. *           {
  46. *              ...
  47. *           }
  48. *
  49. *           cf_UnlockArgList(myGrpNode);
  50. *        }
  51. *        ...
  52. *
  53. *   SEE ALSO
  54. *        cf_LockGrpList(), cf_LockItemList(), cf_UnlockArgList(),
  55. *        cf_NextArgument()
  56. *
  57. ******************************************************************************
  58. *
  59. */
  60.  
  61. SLibCall iCFArgument * cf_LockArgList ( REGA0 iCFGroup * GrpNode )
  62. { return (IsMListEmpty (&GrpNode->ArgList) ? NULL :
  63.                 (iCFArgument *) &GrpNode->ArgList); }
  64.  
  65. /****** configfile.library/cf_LockGrpList ************************************
  66. *
  67. *   NAME
  68. *        cf_LockGrpList -- Locks the group list of the header for use.
  69. *
  70. *   SYNOPSIS
  71. *        FirstGrpNode = cf_LockGrpList(Header);
  72. *        D0                            A0
  73. *
  74. *        CFGroup * cf_LockGrpList(CFHeader *);
  75. *
  76. *   FUNCTION
  77. *        This function locks the group list of the header for use, or NULL
  78. *        if the header has no group nodes. The pointer returned by this is
  79. *        NOT an actual GrpNode pointer - you should use one of the other
  80. *        GrpNode calls to get actual pointers to GrpNode structures (such as
  81. *        cf_NextGrpNode()), passing the value returned by cf_LockGrpList()
  82. *        as the GrpNode value.
  83. *
  84. *   INPUTS
  85. *        Header - Pointer to the CFHeader structure.
  86. *
  87. *   RESULT
  88. *        FirstGrpNode - First group node of the header or NULL.
  89. *                       NOT a valid node!
  90. *
  91. *   EXAMPLE
  92. *        CFHeader * myHeader;
  93. *        CFGroup  * myGrpNode;
  94. *
  95. *        ...
  96. *
  97. *        if ( myGrpNode = cf_LockGrpList (myHeader) )
  98. *        {
  99. *           while ( myGrpNode = cf_NextGroup (myGrpNode) )
  100. *           {
  101. *              ...
  102. *           }
  103. *
  104. *           cf_UnlockGrpList(myHeader);
  105. *        }
  106. *        ...
  107. *
  108. *   SEE ALSO
  109. *        cf_LockArgList(), cf_LockItemList(), cf_UnlockGrpList(),
  110. *        cf_NextGroup()
  111. *
  112. ******************************************************************************
  113. *
  114. */
  115.  
  116. SLibCall iCFGroup * cf_LockGrpList( REGA0 iCFHeader * Header )
  117. { return (IsMListEmpty (&Header->GroupList) ? NULL :
  118.                 (iCFGroup *) &Header->GroupList); }
  119.  
  120. /****** configfile.library/cf_LockItemList ***********************************
  121. *
  122. *   NAME
  123. *        cf_LockItemList -- Locks the item list of an argument node for use.
  124. *
  125. *   SYNOPSIS
  126. *        FirstItemNode = cf_LockItemList(ArgNode);
  127. *        D0                              A0
  128. *
  129. *        CFItem * cf_LockItemList(CFArgument *);
  130. *
  131. *   FUNCTION
  132. *        This function locks the item list of an argument node for use, or
  133. *        NULL if the argument node has no item nodes. The pointer returned by
  134. *        this is NOT an actual ItemNode pointer - you should use one of the
  135. *        other ItemNode calls to get actual pointers to ItemNode structures
  136. *        (such as cf_NextItemNode()), passing the value returned by
  137. *        cf_LockItemList() as the ItemNode value.
  138. *
  139. *   INPUTS
  140. *        ArgNode - The argument node for item list.
  141. *
  142. *   RESULT
  143. *        FirstItemNode - First item node of the argument node or NULL.
  144. *                        NOT a valid node!
  145. *
  146. *   EXAMPLE
  147. *        CFArgument * myArgNode;
  148. *        CFItem     * myItemNode;
  149. *
  150. *        ...
  151. *
  152. *        if ( myItemNode = cf_LockItemList (myArgNode) )
  153. *        {
  154. *           while ( myItemNode = cf_NextItem (myItemNode) )
  155. *           {
  156. *              ...
  157. *           }
  158. *
  159. *           cf_UnlockItemList(myItemNode);
  160. *        }
  161. *        ...
  162. *
  163. *   SEE ALSO
  164. *        cf_LockArgList(), cf_LockGrpList(), cf_UnlockItemList(),
  165. *        cf_NextItem()
  166. *
  167. ******************************************************************************
  168. *
  169. */
  170.  
  171. SLibCall iCFItem * cf_LockItemList ( REGA0 iCFArgument * ArgNode )
  172. { return (IsMListEmpty (&ArgNode->ItemList) ? NULL :
  173.                 (iCFItem *) &ArgNode->ItemList); }
  174.